package edu.uw.nemo.io;

import org.apache.spark.api.java.function.Function;

/**
 * Created by joglekaa on 4/4/15.
 */
public class IntegerArraySerializer implements Function<int[], String> {

    public String call(int[] integers) throws Exception {
        String result = "[";
        boolean first = true;
        for(Integer current: integers) {
            if (first) {
                result += "" + current;
                first = false;
            } else {
                result += ", " + current;
            }
        }
        return result.concat("]");
    }

}
